// X Layer specific types
export interface XLayerToken {
  id: string;
  launchId: number;
  tokenAddress: string;
  creator: string;
  name: string;
  symbol: string;
  description: string;
  website?: string;
  telegram?: string;
  twitter?: string;
  imageUrl?: string;
  
  // Launch parameters
  targetAmount: string; // in ETH
  raisedAmount: string; // in ETH
  tokenPrice: string; // wei per token
  createdAt: number;
  deadline: number;
  
  // Status
  launched: boolean;
  cancelled: boolean;
  
  // Trading info
  currentPrice?: string;
  priceChange24h?: number;
  volume24h?: string;
  marketCap?: string;
  holders?: number;
  
  // User specific
  userBalance?: string;
  userContribution?: string;
}

export interface XLayerLaunchInfo {
  tokenAddress: string;
  creator: string;
  name: string;
  symbol: string;
  description: string;
  targetAmount: string;
  raisedAmount: string;
  deadline: number;
  launched: boolean;
  cancelled: boolean;
  tokenPrice: string;
}

// Trading operation types
export interface XLayerBuyRequest {
  buyerAddress: string;
  buyerPrivateKey: string;
  ethAmount: number;
}

export interface XLayerBuyResponse {
  txHash: string;
  tokensReceived: string;
  newPrice: string;
}

export interface XLayerSellRequest {
  sellerAddress: string;
  sellerPrivateKey: string;
  tokenAmount: number;
}

export interface XLayerSellResponse {
  txHash: string;
  ethReceived: string;
  newPrice: string;
}

export interface XLayerContribution {
  launchId: number;
  contributor: string;
  amount: string;
  tokensReceived: string;
  timestamp: number;
  txHash: string;
}

export interface XLayerStats {
  totalTokens: number;
  totalVolume: string;
  activeTraders: number;
  totalLaunches: number;
  successfulLaunches: number;
}

// Trading related types
export interface XLayerTradeParams {
  launchId: number;
  amount: string; // ETH amount for buying
  slippage?: number; // percentage
}

export interface XLayerTradeResult {
  success: boolean;
  txHash?: string;
  tokensReceived?: string;
  ethSpent?: string;
  error?: string;
}

// Contract interaction types
export interface XLayerContractConfig {
  launchPadAddress: string;
  rpcUrl: string;
  chainId: number;
  blockExplorer: string;
}

// WebSocket events
export interface XLayerWebSocketEvents {
  tokenCreated: XLayerToken;
  tokenUpdated: Partial<XLayerToken> & { id: string };
  contributionMade: XLayerContribution;
  tokenLaunched: { launchId: number; pairAddress: string };
  statsUpdated: XLayerStats;
}

// Form types
export interface CreateXLayerTokenParams {
  name: string;
  symbol: string;
  description: string;
  website?: string;
  telegram?: string;
  twitter?: string;
  targetAmount: string; // ETH
  tokenPrice: string; // wei per token
  imageFile?: File;
}

// Price chart data
export interface XLayerPriceData {
  timestamp: number;
  price: number;
  volume: number;
}

export interface XLayerChartData {
  prices: XLayerPriceData[];
  volume: XLayerPriceData[];
  period: '1h' | '24h' | '7d' | '30d';
}